package controllers

import (
	"fmt"
	beego "github.com/beego/beego/v2/server/web"
	"shop/models"
)

type ShopController struct {
	beego.Controller
}

func (c *ShopController) ShopCount() {
	var count int64
	result := models.DB.Model(models.Shop{}).Count(&count)
	if result.Error != nil {
		c.Ctx.WriteString(fmt.Sprintf("查询商品数量失败: %v", result.Error))
		return
	}

	c.Ctx.WriteString(fmt.Sprintf("商品数量: %d", count))
}
